package com.baiye.template.controller;

import com.baiye.template.common.R;
import com.baiye.template.pojo.Role;
import com.baiye.template.pojo.User;
import com.baiye.template.service.UserService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author GUOZHIPENG
 * @version 1.0
 * @date 2021/9/19 16:23
 */
@RestController
@Api(value = "用户管理")
@RequestMapping("/userManager")
public class UserManagerController {
    @Autowired
    private UserService userService;
    @RequestMapping(value = "/getUser",method = RequestMethod.POST)
    public R getRole(@RequestBody User user, @Param(value = "pageIndex")Integer pageIndex, @Param(value = "pageSize") Integer pageSize){
        List<User> i = userService.getUser(user,pageIndex,pageSize);
        PageInfo<User> pageInfo = new PageInfo<>(i);
        return new R().ok(pageInfo);
    }
}
